import { ETaskState } from "GameLoop/DecisionMaking/TaskDeclare/type";
 
export abstract class ATaskAdapter<T extends TaskType>
{
    protected world:WorldGetter;
    protected contextgetter:IContextGetter
    protected _notify!:Notify 
    constructor(context:IContextGetter,world:WorldGetter)
    {
        this.world = world;
        this.contextgetter = context
        this._notify =  this.world.registerNotify.bind(this.world) ;
       
    }
    
    protected notify<T extends TEventTypes> (region:EventRegion,eventtype:IWorldEvents[T]&{type:T}):void
    {
        this._notify(region,eventtype as any);
    }

    protected abstract checkState(room:Room,task:ITaskDeclare[T]):ETaskState;

 
    abstract bindTasks(room:Room,task:ITaskDeclare[T][],customCheck:IConditionFunction):void;
}